package com.wzh.controll;

import com.alibaba.fastjson.JSONObject;
import com.github.kevinsawicki.http.HttpRequest;
import com.wzh.pojo.Po.UserZp;
import com.wzh.pojo.Resp.DataResp;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Controller
@RequestMapping("/sms")
public class SmsController {

	@PostMapping("/send")
	@ResponseBody
	public DataResp login(@RequestBody Map<String,Object> param){
		System.out.println(param.get("code"));
		JSONObject jsonObject = new JSONObject();
		jsonObject.put("password","25d55ad283aa400af464c76d713c07ad");
		jsonObject.put("mobile",param.get("phone"));
		jsonObject.put("clientid","b02xc1");
		jsonObject.put("smstype","4");
		jsonObject.put("content","【藏聘】您的验证码是"+param.get("code")+"，如非本人操作，请忽略此条短信");
		HttpRequest httpRequest = HttpRequest.post("https://u.smsyun.cc/sms-partner/access/b02xc1/sendsms").acceptJson();
		httpRequest.send(jsonObject.toString());
		String body = httpRequest.body();//返回结果
		DataResp resp= new DataResp();
		resp.setData(body);
		return resp;
	};
}
